package cn.ywang.event;

import java.lang.reflect.Method;

/**
 * @author BeatificWang
 * @date 2019/1/1 17:56
 */
public class Event {
	/**
	 * 事件源（被观察者）
	 */
	private Object source;

	/**
	 * 通知目标（观察者）
	 */
	private Object target;

	/**
	 * 触发器
	 */
	private String trigger;

	/**
	 * 回调方法
	 */
	private Method callBack;
	/**
	 * 调用时间
	 */
	private Long time;

	public Event(Object target, Method callBack) {
		this.target = target;
		this.callBack = callBack;
	}

	public Long getTime() {
		return this.time;
	}

	public void setTime(Long time) {
		this.time = time;
	}

	public Object getSource() {
		return this.source;
	}

	public void setSource(Object source) {
		this.source = source;
	}

	public Object getTarget() {
		return this.target;
	}

	public void setTarget(Object target) {
		this.target = target;
	}

	public String getTrigger() {
		return this.trigger;
	}

	public void setTrigger(String trigger) {
		this.trigger = trigger;
	}

	public Method getCallBack() {
		return this.callBack;
	}

	public void setCallBack(Method callBack) {
		this.callBack = callBack;
	}

	@Override
	public String toString() {
		return "event{" +
				       "source=" + this.source +
				       ", target=" + this.target +
				       ", trigger='" + this.trigger + '\'' +
				       ", callBack=" + this.callBack +
				       ", time=" + this.time +
				       '}';
	}
}
